package edu.pku.sei.ocl.evaluation;

import org.eclipse.emf.ecore.EClassifier;

import edu.pku.sei.ocl.types.TypesPackage;
import edu.pku.sei.ocl.utilities.OCLConstant;

public class OCLVariable {
	private String name;
	private EClassifier type;
	private String typeString;
	private String modelName = OCLConstant.DEFAULTMODEL;
	private Object initValue = OCLConstant.OCLInvalid;
	
	
	public boolean equals(Object var){
		if(var instanceof OCLVariable){
			if(getName().equals(((OCLVariable) var).getName()))//do not check type
				return true;
		}
		return false;
	}


	@Override
	public int hashCode() {
		return getName().hashCode();
	}


	@Override
	public String toString() {
		return getName();
	}


	public EClassifier getType() {
		return type;
	}


	public void setType(EClassifier type) {
		this.type = type;
		this.typeString = type.getName();
	}
	
	public void setType(String typeName){
		this.type = TypesPackage.eINSTANCE.getOclAny();
		this.typeString = typeName;
	}


	public String getName() {
		return name;
	}


	public void setName(String name) {
		this.name = name;
	}


	public String getTypeString() {
		return typeString;
	}


	public void setTypeString(String typeString) {
		this.typeString = typeString;
	}


	public String getModelName() {
		return modelName;
	}


	public void setModelName(String modelName) {
		this.modelName = modelName;
	}


	public Object getInitValue() {
		return initValue;
	}


	public void setInitValue(Object initValue) {
		this.initValue = initValue;
	}
	
	
}
